#include <iostream>

#include <forward_list>

using std::cout;
using std::endl;

template<typename T>
void printList(const T& c)
{
	for (auto v : c)
	{
		cout << v << "  ";
	}
	cout << endl;
}

int main()
{
	std::forward_list<int> fl{ 7, 8, 3, 4, 5};
	fl.push_front(3);
	printList(fl);
	fl.sort();
	printList(fl);

	auto it = fl.begin();
	fl.insert_after(it, 12);
	cout << "insert 12 berfor begin: ";
	printList(fl);

	auto it2 = fl.before_begin();
	cout << "insert 13 and 14 berfor begin: ";
	fl.insert_after(it2, 13);
	fl.insert_after(it2, 14);
	printList(fl);

	return 0;
}










